
// import oimo.dynamics.rigidbody.RigidBody;
// import oimo.dynamics.rigidbody.*;

import { Contact } from "./Contact";
import { RigidBody } from "./rigidbody/RigidBody";

/**
 * A contact link is used to build a constraint graph for clustering rigid bodies.
 * In a constraint graph, rigid bodies are nodes and constraints are edges.
 * See also `JointLink`.
 */

export class ContactLink {
	_prev: ContactLink;
	_next: ContactLink;
	_contact: Contact;
	_other: RigidBody;


	constructor() {
		this._prev = null;
		this._next = null;
		this._contact = null;
		this._other = null;
	}

	/**
	 * Returns the contact of the link.
	 */
	public getContact(): Contact {
		return this._contact;
	}

	/**
	 * Returns the other rigid body of the link. This provides a quick access from a
	 * rigid body to the other one of the contact.
	 */
	public getOther(): RigidBody {
		return this._other;
	}

	/**
	 * Returns the previous contact link in the rigid body.
	 *
	 * If the previous one does not exist, `null` will be returned.
	 */
	public getPrev(): ContactLink {
		return this._prev;
	}

	/**
	 * Returns the next contact link in the rigid body.
	 *
	 * If the next one does not exist, `null` will be returned.
	 */
	public getNext(): ContactLink {
		return this._next;
	}
}
